package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import bean.Outlet;
import util.DBUtil;

public class OutletDao {
    DBUtil db=new DBUtil();
    Connection conn=db.open();
    PreparedStatement pstmt=null;
    
   //添加排放口
    public void addoutlet(String outlet_name,String company_id){
    	String add="insert into outlet(outlet_name,company_id) values(?,?)";
    	try {
			pstmt=conn.prepareStatement(add);
			pstmt.setString(1, outlet_name);
			pstmt.setString(2, company_id);
			pstmt.executeUpdate();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}  	
    }
    //删除排放口
    public void deleteout(String outlet_id){
    	String delete="delete from outlet where outlet_id='"+outlet_id+"'";
    	try {
			pstmt=conn.prepareStatement(delete);
			pstmt.executeUpdate();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			db.close();
		}
    }
   
}
